<template>
  <j-modal
    :title="title"
    :width="600"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel">
     <flower-channel-form ref="realForm" @ok="submitCallback"/>
  </j-modal>
</template>

<script>

 import FlowerChannelForm from './FlowerChannelForm'
 export default {
     name: 'FlowerChannelModal',
     components: {
       FlowerChannelForm
     },
     data() {
       return {
         title:'',
         visible: false,
         disableSubmit: false
       }
     },
     methods:{
       add () {
         this.visible=true
         this.$nextTick(()=>{
           this.$refs.realForm.add();
         })
       },
       edit (record) {
         this.visible=true
         this.$nextTick(()=>{
           this.$refs.realForm.edit(record);
         })
       },
       close () {
         this.$emit('close');
         this.visible = false;
       },
       handleOk () {
         let channel=this.$refs.realForm.model.channel
         if (channel===undefined||channel===''||channel===' '){
           this.$message.error('请输入渠道')
         }else {
           this.$refs.realForm.handleOk();
         }
       },
       submitCallback(){
         this.$emit('ok');
         this.visible = false;
       },
       handleCancel () {
         this.close()
       }
     }
   }
</script>

<style scoped>
</style>